# -*- python -*-
# Copyright 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

Import('env')

if env['TOOLCHAIN_FEATURE_VERSION'] < 4:
  # In old versions of the PNaCl toolchain, computed gotos are left as
  # "indirectbr" and "blockaddress", which are not allowed by PNaCl's
  # stable ABI.
  if not env.SetNonStableBitcodeIfAllowed():
    Return()
  if env.Bit('bitcode'):
    env.Append(LINKFLAGS=['--pnacl-disable-abi-check'])

# We are testing a GNU C extension which is disallowed by "-pedantic" mode.
env.FilterOut(CCFLAGS=['-pedantic'])

prog = env.ComponentProgram('computed_goto', 'computed_goto.c',
                            EXTRA_LIBS=['${NONIRT_LIBS}'])
node = env.CommandSelLdrTestNacl('computed_goto_test.out', prog)
env.AddNodeToTestSuite(node, ['small_tests'], 'run_computed_goto_test')
